inherited fmDopUslTariffs: TfmDopUslTariffs
  Left = 472
  Top = 211
  Width = 1269
  Height = 739
  Caption = #1058#1072#1088#1080#1092#1099' '#1085#1072' '#1076#1086#1087'. '#1091#1089#1083#1091#1075#1080
  Constraints.MinHeight = 553
  Constraints.MinWidth = 895
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 685
    Width = 1261
  end
  inherited Panel1: TPanel
    Width = 1261
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 1091
    end
    inherited BitBtn2: TBitBtn
      Left = 1179
    end
  end
  object Panel2: TPanel [2]
    Left = 0
    Top = 98
    Width = 1261
    Height = 587
    Align = alClient
    Caption = 'Panel2'
    TabOrder = 2
    object dbgDUT: TcxGrid
      Left = 1
      Top = 1
      Width = 1259
      Height = 585
      Align = alClient
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 0
      LookAndFeel.Kind = lfStandard
      object tvDUT: TcxGridDBTableView
        OnMouseDown = tvDUTMouseDown
        NavigatorButtons.ConfirmDelete = False
        NavigatorButtons.PriorPage.Visible = True
        NavigatorButtons.Next.Visible = True
        NavigatorButtons.Insert.Visible = True
        NavigatorButtons.Append.Visible = False
        NavigatorButtons.Edit.Visible = False
        NavigatorButtons.Post.Visible = True
        NavigatorButtons.Cancel.Visible = False
        NavigatorButtons.Refresh.Visible = False
        NavigatorButtons.SaveBookmark.Visible = False
        NavigatorButtons.GotoBookmark.Visible = False
        NavigatorButtons.Filter.Visible = False
        OnCellDblClick = tvDUTCellDblClick
        OnEditValueChanged = tvDUTEditValueChanged
        DataController.DataSource = dlgDS
        DataController.Summary.DefaultGroupSummaryItems = <>
        DataController.Summary.FooterSummaryItems = <
          item
            Format = '0'
            Kind = skCount
            FieldName = 'PLASTNAME'
            Column = tvDUTPLASTNAME
          end>
        DataController.Summary.SummaryGroups = <>
        OptionsBehavior.CellHints = True
        OptionsBehavior.IncSearch = True
        OptionsCustomize.ColumnFiltering = False
        OptionsData.CancelOnExit = False
        OptionsData.Deleting = False
        OptionsData.DeletingConfirmation = False
        OptionsData.Editing = False
        OptionsData.Inserting = False
        OptionsView.CellEndEllipsis = True
        OptionsView.CellAutoHeight = True
        OptionsView.CellTextMaxLineCount = 1
        OptionsView.ColumnAutoWidth = True
        OptionsView.Footer = True
        OptionsView.GroupByBox = False
        OptionsView.HeaderEndEllipsis = True
        OptionsView.Indicator = True
        Preview.Visible = True
        Styles.Header = DMInv.cxSiniyText
        object tvDUTPLASTNAME: TcxGridDBColumn
          Caption = #1060#1072#1084#1080#1083#1080#1103
          DataBinding.FieldName = 'PLASTNAME'
          Width = 69
        end
        object tvDUTPNAME: TcxGridDBColumn
          Caption = #1048#1084#1103
          DataBinding.FieldName = 'PNAME'
          Width = 35
        end
        object tvDUTPPATRONYMIC: TcxGridDBColumn
          Caption = #1054#1090#1095#1077#1089#1090#1074#1086
          DataBinding.FieldName = 'PPATRONYMIC'
          Width = 76
        end
        object tvDUTDOLJ: TcxGridDBColumn
          Caption = #1044#1086#1083#1078#1085#1086#1089#1090#1100
          DataBinding.FieldName = 'DOLJ'
          Width = 87
        end
        object tvDUTDU: TcxGridDBColumn
          Caption = #1059#1089#1083#1091#1075#1072
          DataBinding.FieldName = 'DU'
          Width = 56
        end
        object tvDUTTTARIF: TcxGridDBColumn
          Caption = #1058#1072#1088#1080#1092
          DataBinding.FieldName = 'TTARIF'
          Width = 53
        end
        object tvDUTTDATEBEGIN: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1085#1072#1095#1072#1083#1072
          DataBinding.FieldName = 'TDATEBEGIN'
          Width = 98
        end
        object tvDUTTDATEEND: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095#1072#1085#1080#1103
          DataBinding.FieldName = 'TDATEEND'
          Width = 123
        end
        object tvDUTTNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081
          DataBinding.FieldName = 'TNOTE'
          PropertiesClassName = 'TcxMemoProperties'
          Width = 73
        end
      end
      object cxGridLevel2: TcxGridLevel
        GridView = tvDUT
      end
    end
    object cxMemo1: TcxMemo
      Left = 270
      Top = 112
      Lines.Strings = (
        'cxMemo1')
      TabOrder = 1
      Visible = False
      Height = 254
      Width = 729
    end
  end
  inherited dlgDS: TDataSource
    DataSet = qTariff
    Left = 384
    Top = 168
  end
  object qSD: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.sdparid, t1.sdid, t1.sdname, t1.SDISDELETE'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, SDISDELETE)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, sd.SDISDELETE FROM' +
        ' SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDPARID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, sd1.SDISDELETE'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID, SDISDELETE FROM tree t'
      ') AS t1'
      'WHERE t1.SDISDELETE = 0')
    GeneratorField.Field = 'SDID'
    Left = 240
    Top = 176
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'sdparid'
        ParamType = ptUnknown
      end>
    object qSDSDID: TIntegerField
      FieldName = 'SDID'
      ProviderFlags = []
    end
    object qSDSDPARID: TIntegerField
      FieldName = 'SDPARID'
      ProviderFlags = []
    end
    object qSDSDNAME: TIBStringField
      DisplayLabel = #1069#1083#1077#1084#1077#1085#1090
      FieldName = 'SDNAME'
      ProviderFlags = []
      Size = 2304
    end
    object qSDSDISDELETE: TIntegerField
      DisplayLabel = #1059#1076#1072#1083#1080#1090#1100'?'
      FieldName = 'SDISDELETE'
      Origin = '"SYS_DIC"."SDISDELETE"'
    end
  end
  object dsSD: TDataSource
    DataSet = qSD
    Left = 203
    Top = 174
  end
  object qTariff: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    SQL.Strings = (
      
        'SELECT T.TTARIF, T.TDATEBEGIN, T.TDATEEND, T.TNOTE, t.sdid, t.ti' +
        'd, t.pid, P.PLASTNAME,'
      'P.PNAME, P.PPATRONYMIC, sd.SDNAME AS du, dolj.dol AS DOLJ'
      'FROM DOP_USL_TARIFFS T'
      'INNER JOIN PEOPLE P ON P.PID = T.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = t.SDID'
      'INNER JOIN'
      '('
      'SELECT D.PID, LIST(SD1.SDNAME, '#39', '#39') AS dol'
      'FROM DOLJNOST_PEOPLE D'
      
        'INNER JOIN DOLJNOST DD ON DD.DOLID = D.DOLID AND :date BETWEEN D' +
        'D.DOLDATEBEGIN AND COALESCE(DD.DOLDATEEND, CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD1 ON SD1.SDID = DD.SDID'
      
        'WHERE :date BETWEEN D.DOLDATEBEGIN AND COALESCE(D.DOLDATEEND, CU' +
        'RRENT_DATE+3650)'
      'AND D.DOLISDELETE IS NULL'
      'AND DD.DOLISDELETE IS NULL'
      'GROUP BY 1'
      ') AS dolj ON dolj.pid = T.PID'
      'where 1=1')
    UpdateObject = quTariff
    GeneratorField.Field = 'TID'
    GeneratorField.Generator = 'GEN_DOP_USL_TARIFFS_ID'
    Left = 425
    Top = 173
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'date'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date'
        ParamType = ptUnknown
      end>
    object qTariffTTARIF: TIBBCDField
      FieldName = 'TTARIF'
      Origin = '"DOP_USL_TARIFFS"."TTARIF"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qTariffTDATEBEGIN: TDateField
      FieldName = 'TDATEBEGIN'
      Origin = '"DOP_USL_TARIFFS"."TDATEBEGIN"'
    end
    object qTariffTDATEEND: TDateField
      FieldName = 'TDATEEND'
      Origin = '"DOP_USL_TARIFFS"."TDATEEND"'
    end
    object qTariffTNOTE: TIBStringField
      FieldName = 'TNOTE'
      Origin = '"DOP_USL_TARIFFS"."TNOTE"'
      Size = 2048
    end
    object qTariffSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"DOP_USL_TARIFFS"."SDID"'
    end
    object qTariffTID: TIntegerField
      FieldName = 'TID'
      Origin = '"DOP_USL_TARIFFS"."TID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qTariffPID: TIntegerField
      FieldName = 'PID'
      Origin = '"DOP_USL_TARIFFS"."PID"'
    end
    object qTariffPLASTNAME: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object qTariffPNAME: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object qTariffPPATRONYMIC: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object qTariffDU: TIBStringField
      FieldName = 'DU'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qTariffDOLJ: TMemoField
      FieldName = 'DOLJ'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object quTariff: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  TTARIF,'
      '  TDATEBEGIN,'
      '  TDATEEND,'
      '  TNOTE,'
      '  SDID,'
      '  TID,'
      '  PID'
      'from DOP_USL_TARIFFS '
      'where'
      '  TID = :TID')
    ModifySQL.Strings = (
      'update DOP_USL_TARIFFS'
      'set'
      '  PID = :PID,'
      '  SDID = :SDID,'
      '  TDATEBEGIN = :TDATEBEGIN,'
      '  TDATEEND = :TDATEEND,'
      '  TID = :TID,'
      '  TNOTE = :TNOTE,'
      '  TTARIF = :TTARIF'
      'where'
      '  TID = :OLD_TID')
    InsertSQL.Strings = (
      'insert into DOP_USL_TARIFFS'
      '  (PID, SDID, TDATEBEGIN, TDATEEND, TID, TNOTE, TTARIF)'
      'values'
      '  (:PID, :SDID, :TDATEBEGIN, :TDATEEND, :TID, :TNOTE, :TTARIF)')
    DeleteSQL.Strings = (
      'delete from DOP_USL_TARIFFS'
      'where'
      '  TID = :OLD_TID')
    Left = 465
    Top = 173
  end
  object dxBarManager1: TdxBarManager
    AllowReset = False
    AlwaysSaveText = True
    AutoDockColor = False
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    Categories.Strings = (
      'Default')
    Categories.ItemsVisibles = (
      2)
    Categories.Visibles = (
      True)
    DockColor = clBtnFace
    ImageOptions.Images = DMInv.cxSmallImages
    PopupMenuLinks = <>
    Style = bmsUseLookAndFeel
    UseSystemFont = True
    Left = 704
    Top = 249
    DockControlHeights = (
      0
      0
      53
      0)
    object dxBarManager1Bar1: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = 'addedit'
      CaptionButtons = <>
      DockedDockingStyle = dsTop
      DockedLeft = 0
      DockedTop = 27
      DockingStyle = dsTop
      FloatLeft = 410
      FloatTop = 185
      FloatClientWidth = 0
      FloatClientHeight = 0
      ItemLinks = <
        item
          Visible = True
          ItemName = 'bbAdd'
        end
        item
          Visible = True
          ItemName = 'bbEdit'
        end
        item
          Visible = True
          ItemName = 'bbDel'
        end>
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 1
      UseOwnFont = False
      UseRestSpace = True
      Visible = True
      WholeRow = False
    end
    object dxBarManager1Bar2: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = 'main'
      CaptionButtons = <>
      DockedDockingStyle = dsTop
      DockedLeft = 0
      DockedTop = 0
      DockingStyle = dsTop
      FloatLeft = 458
      FloatTop = 272
      FloatClientWidth = 51
      FloatClientHeight = 22
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -15
      Font.Name = 'Arial'
      Font.Style = []
      ItemLinks = <
        item
          UserDefine = [udWidth]
          UserWidth = 476
          Visible = True
          ItemName = 'beDU'
        end
        item
          BeginGroup = True
          UserDefine = [udWidth]
          UserWidth = 146
          Visible = True
          ItemName = 'beDate'
        end
        item
          BeginGroup = True
          Visible = True
          ItemName = 'bbFind'
        end
        item
          BeginGroup = True
          Visible = True
          ItemName = 'bbReload'
        end
        item
          Visible = True
          ItemName = 'bbService'
        end>
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 0
      UseOwnFont = True
      UseRestSpace = True
      Visible = True
      WholeRow = False
    end
    object bbAdd: TdxBarButton
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100
      Category = 0
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100
      Visible = ivAlways
      ImageIndex = 51
      OnClick = bbAddClick
    end
    object bbEdit: TdxBarButton
      Caption = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1090#1100
      Category = 0
      Hint = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1090#1100
      Visible = ivAlways
      ImageIndex = 54
      OnClick = bbEditClick
    end
    object bbDel: TdxBarButton
      Caption = #1059#1076#1072#1083#1080#1090#1100
      Category = 0
      Hint = #1059#1076#1072#1083#1080#1090#1100
      Visible = ivAlways
      ImageIndex = 46
      OnClick = bbDelClick
    end
    object beDU: TcxBarEditItem
      Caption = #1044#1086#1087'. '#1091#1089#1083#1091#1075#1072':'
      Category = 0
      Hint = #1044#1086#1087'. '#1091#1089#1083#1091#1075#1072':'
      Visible = ivAlways
      OnChange = beDUChange
      ShowCaption = True
      Width = 100
      PropertiesClassName = 'TcxButtonEditProperties'
      Properties.Buttons = <
        item
          Default = True
        end>
      Properties.OnButtonClick = beDUPropertiesButtonClick
      InternalEditValue = ''
    end
    object beDate: TcxBarEditItem
      Caption = #1053#1072' '#1076#1072#1090#1091
      Category = 0
      Hint = #1053#1072' '#1076#1072#1090#1091
      Visible = ivAlways
      ShowCaption = True
      Width = 100
      PropertiesClassName = 'TcxDateEditProperties'
      Properties.OnChange = beDUChange
    end
    object bbFind: TdxBarButton
      Caption = #1048#1089#1082#1072#1090#1100
      Category = 0
      Hint = #1048#1089#1082#1072#1090#1100
      Visible = ivAlways
      ImageIndex = 53
      PaintStyle = psCaptionGlyph
      OnClick = bbFindClick
    end
    object bbReload: TdxBarButton
      Caption = #1054#1073#1085#1086#1074#1080#1090#1100
      Category = 0
      Hint = #1054#1073#1085#1086#1074#1080#1090#1100
      Visible = ivAlways
      ImageIndex = 55
      PaintStyle = psCaptionGlyph
      OnClick = bbReloadClick
    end
    object bbService: TdxBarButton
      Align = iaRight
      Caption = 'Service'
      Category = 0
      Hint = 'Service'
      Visible = ivAlways
      ImageIndex = 60
      OnClick = bbServiceClick
    end
  end
  object qTemp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT T.TTARIF, T.TDATEBEGIN, T.TDATEEND, T.TNOTE, t.sdid, t.ti' +
        'd, t.pid, P.PLASTNAME,'
      'P.PNAME, P.PPATRONYMIC, sd.SDNAME AS du, dolj.dol AS DOLJ'
      'FROM DOP_USL_TARIFFS T'
      'INNER JOIN PEOPLE P ON P.PID = T.PID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = t.SDID'
      'INNER JOIN'
      '('
      'SELECT D.PID, LIST(SD1.SDNAME, '#39', '#39') AS dol'
      'FROM DOLJNOST_PEOPLE D'
      
        'INNER JOIN DOLJNOST DD ON DD.DOLID = D.DOLID AND :date BETWEEN D' +
        'D.DOLDATEBEGIN AND COALESCE(DD.DOLDATEEND, CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD1 ON SD1.SDID = DD.SDID'
      
        'WHERE :date BETWEEN D.DOLDATEBEGIN AND COALESCE(D.DOLDATEEND, CU' +
        'RRENT_DATE+3650)'
      'AND D.DOLISDELETE IS NULL'
      'AND DD.DOLISDELETE IS NULL'
      'GROUP BY 1'
      ') AS dolj ON dolj.pid = T.PID'
      'where 1=1')
    GeneratorField.Field = 'TID'
    Left = 425
    Top = 221
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'date'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date'
        ParamType = ptUnknown
      end>
  end
end
